export function generateProxyTable(mode) {
  const proxyTableVite = {}
  if (mode === 'mock') {
    return proxyTableVite
  }
  const proxyTable = {
    '/api': {
      target: 'http://172.16.3.158:30001',
    },
  }
  Object.keys(proxyTable).forEach((proxyKey) => {
    const target = proxyTable[proxyKey].target || proxyTable[proxyKey]
    const rewrite = proxyTable[proxyKey].rewrite || ''
    proxyTableVite[proxyKey] = {
      target: target,
      secure: false,
      changeOrigin: true,
      rewrite: (path, add) => path.replace(new RegExp(`^${proxyKey}`), rewrite),
    }
  })
  return proxyTableVite
}
